package com.example.utils;


import io.jsonwebtoken.*;

import java.util.Date;
import java.util.Map;

public class jwtutil {

    public static  String CreateJwt(Map<String,Object> clams,String Key) {

        JwtBuilder jwtBuilder = Jwts.builder()
                .setClaims(clams)
                .signWith(SignatureAlgorithm.HS256, Key.getBytes());
        return jwtBuilder.compact();
    }


    public  static  Claims  parser(String token,String key) {
        Claims claims = Jwts.parser()
                .setSigningKey(key.getBytes())
                .parseClaimsJws(token).getBody();
        return claims;
    }
}
